<?php
echo $this->Form->create(null,array('action'=>'showForms'));
    echo $this->Form->input('DmdformCode',array('label'=>__('Demand form code',true)));
    echo $this->Form->input('dmdforms_dmdformtype_id',array('options'=>$types,'empty'=>'select','label'=>__('Demand form type',true)));
?> <fieldset><legend><?php __('Demand form creation date');  ?></legend><table><tr><td><?php
    echo $this->Form->input('form_date_begin',array('type'=>'text','empty'=>'select','label'=>__('From',true),'id'=>'from'));?> </td><td><?php
    echo $this->Form->input('form_date_end',array('type'=>'text','empty'=>'select','label'=>__('To',true),'id'=>'to'));
?></td></tr></table></fieldset><?php
    echo $this->Form->input('dmdformstatus_id',array('options'=>$statuses,'empty'=>'select','label'=>__('Demand form status',true)));
    echo $this->Form->input('demander_id',array('options'=>$demanders,'empty'=>'select','label'=>__('Demander name',true)));
    echo $this->Form->input('user_id',array('options'=>$users,'empty'=>'select','label'=>__('User name',true)));

echo $this->Form->end(__('Submit',true));

?>
<script type="text/javascript">
    $(function() {
		var dates = $( "#from, #to" ).datepicker({			
			changeMonth: true,
                        dateFormat: 'yy-mm-dd',
			numberOfMonths: 1,
			onSelect: function( selectedDate ) {
				var option = this.id == "from" ? "minDate" : "maxDate",
					instance = $( this ).data( "datepicker" ),
					date = $.datepicker.parseDate(
						instance.settings.dateFormat ||
						$.datepicker._defaults.dateFormat,
						selectedDate, instance.settings );
				dates.not( this ).datepicker( "option", option, date );
			}
		});
	});
</script>